<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>{$activityname}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
<link href="{$Think.config.RESOURCEURL}wx_assets/vote/vote.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
</head>
<body class="bg-common">
<div style="background-image:url({$jsonstr.COMMON_BACKGROUND_OTHER.src})">
<a class="bg-common bg_zjt js-btn" href='{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=list&params=%7B%22actId%22%3A%22{$actId}%22%7D' style="background-image:url({$jsonstr.COMMON_BUTTON_BACK.src})"></a>
<div class="bg-common toupiao-zhuti" style="background-image:url({$jsonstr.BAOMING_ZHUTI.src});" style="height:30px"></div>
<div class="info">
    <volist name="regInfo.picurl" id="pic">
        <img src="{$pic}"  class="imgDiv" id="imgDiv"/>
    </volist>
    <div class="detail">
        <span style="text-align:left;">{$regInfo.id}号</span>
        <span style="text-align:center;">{$regInfo.name}</span>
        <span style="text-align:right;"><label id="voteCount">{$regInfo.votecount}</label>票</span>
    </div>
    <div class="vote">
        <if condition="($vote eq '') and ($actStatus eq '0')"> 
        <a class="bg-common js-btn" id="vote" data-normal="{$jsonstr.TOUPIAO_BUTTON_TOUPIAO_NORMAL.src}" data-click="{$jsonstr.TOUPIAO_BUTTON_TOUPIAO_CLICK.src}" data-disabled="{$jsonstr.TOUPIAO_BUTTON_TOUPIAO_DISABLED.src}"
           style="background-image:url({$jsonstr.TOUPIAO_BUTTON_TOUPIAO_NORMAL.src});">
            <img src="{$jsonstr.TOUPIAO_BUTTON_TOUPIAO_CLICK.src}" id="TOUPIAO_BUTTON_TOUPIAO" style="display:none"/>
        </a>
        <else/>
            <a class="bg-common js-btn disabled" id="vote" data-normal="TOUPIAO_BUTTON_TOUPIAO" data-disabled="{$jsonstr.TOUPIAO_BUTTON_TOUPIAO_DISABLED.src}"
               style="background-image:url({$jsonstr.TOUPIAO_BUTTON_TOUPIAO_DISABLED.src})">
            </a>
            <if condition="$actStatus eq '2'"> 
                <div style="text-align: center;line-height: 25px;color: red;">投票已截止</div>
            </if>
         </if>
    </div>
</div>
<script type="text/javascript" charset="utf-8">
  var previewImageUrls=["{$regInfo.picurl}"];
  //图片预览
  $("#imgDiv").click(function(){
        wx.previewImage({
          current:"{$regInfo.picurl}",
          urls: previewImageUrls
       });
  })
</script>
<div class="btnDiv">
    <div class="refueling">
          <a class="bg-common js-btn" id="JIAYOU" data-normal="{$jsonstr.TOUPIAO_BUTTON_JIAYOU_NORMAL.src}"
           data-click="{$jsonstr.TOUPIAO_BUTTON_JIAYOU_CLICK.src}" style="background-image:url({$jsonstr.TOUPIAO_BUTTON_JIAYOU_NORMAL.src})"></a>
   <a class="bg-common js-btn" id="JIAYOU" data-normal="{$jsonstr.TOUPIAO_BUTTON_JIAYOU_NORMAL.src}"
           data-click="{$jsonstr.TOUPIAO_BUTTON_JIAYOU_CLICK.src}" style="background-image:url({$jsonstr.TOUPIAO_BUTTON_JIAYOU_NORMAL.src})"></a>
        <img src="{$jsonstr.TOUPIAO_BUTTON_JIAYOU_CLICK.src}" id="TOUPIAO_BUTTON_JIAYOU" style="display:none"/></div>
    <div class="see">
        <a class="bg-common js-btn" data-href="{$Think.config.SERVER_HOST}call.html?customerId={$customerId}&module=vote&method=index&params=%7B%22actId%22%3A%22{$actId}%22%7D"
           data-normal="{$jsonstr.TOUPIAO_BUTTON_CHAKAN_NORMAL.src}" data-click="{$jsonstr.TOUPIAO_BUTTON_CHAKAN_CLICK.src}" style="background-image:url({$jsonstr.TOUPIAO_BUTTON_CHAKAN_NORMAL.src})"></a>
        <img id="TOUPIAO_BUTTON_CHAKAN" src="{$jsonstr.TOUPIAO_BUTTON_CHAKAN_CLICK.src}" style="display:none"/></div>
</div>
<div class="shareTip" style="background-image: url({$jsonstr.COMMON_SHARE_BG.src});">
</div>
</div>
<script>
var baseUrl = '{$Think.config.SERVER_HOST}';
var shareUrl="";
var detail={
    init:function(){
        this.initButtonState();
    },
    initButtonState:function(){
        $(".js-btn").tap(function(){
            if(!$(this).hasClass("disabled")){
                var clickUrl=$(this).data("click");
                var normalUrl=$(this).data("normal");
                $(this).css("background-image","url("+clickUrl+")");
                var me=this;
                setTimeout(function(){
                    $(me).css("background-image","url("+normalUrl+")");
                    if($(me).data("href")) {
                       location.href=$(me).data("href"); 
                    }
                },100);
            }
        });
        $("#vote").click(function(){
            var me=$(this);
            if(me.hasClass("disabled")){
                return;
            }
            $.req.get("call.json?customerId={$customerId}&module=vote&method=vote",{
                params:{
                    "rId": "{$regInfo.id}",
                    "actId": "{$actId}"
                }
            },function(data){
                if(data && !data.code){
                    me.addClass("disabled");
                    me.css("background-image","url("+me.data("disabled")+")");
                    $("#voteCount").text(data.votecount);
                    $.util.alert("投票成功!");
                } 
            });
        })
        $("#JIAYOU").click(function(){
           $(".shareTip").show();
        });
        $(".shareTip").click(function(){
            $(this).hide();
            $("#JIAYOU").css("background-image","url("+$("#JIAYOU").data("normal")+")");
        })
    }

}
detail.init();
wx_share.init({
    "title":"{$title1}",
    "desc":'{$description1}',
    "link":shareUrl,
    "imgUrl":"{$picurl1}",
    "pkg":{
        "appId": '{$pkg.appId}',
        "timestamp": {$pkg.timestamp},
        "nonceStr": '{$pkg.nonceStr}',
        "signature": '{$pkg.signature}'
    },
    success:function(config,shareType){
        var p=$.util.getParamAsObject();
        $.req.get("call.json?customerId={$customerId}&module=quan&method=saveShare",{
            params:{
                "qId":p.qId,
                "sId":"{$sId}",
                "guid":"{$guid}",
                "fromGuid":p.fromGuid,
                "miUId":"{$fromUId}",
                "shareType":shareType,
                "fromPage":"toupiao_detail"
            }
        },function(data){
            if(data && !data.code){

            }
        });
    }
 });
</script>
</body>
</html>